
package testemodulorede;

import java.net.*;
import java.io.*;

public class Listenner implements Runnable{

    private BufferedReader reader;
    Chat chat;

    public Listenner( Chat _chat, BufferedReader _reader ){

        reader = _reader;
        chat = _chat;

    }

    public void run(){

        String message;
        
        try{

            while( ( message = reader.readLine() ) != null ){

                if( message.charAt(0) == '9' ){

                    chat.incomingMessage(message);
                
                }
                
            }
        }

        catch(Exception ex){

            ex.printStackTrace();

        }

    }

}
